<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Pay extends Model
{
    use HasFactory;
    protected  $table='order_pay';
    protected $guarded='';
    use SoftDeletes;
    /**
     * @return mixed
     * 支付类型展示
     */
    public static function lists(){
        return self::all();
    }

    /**
     * @param $data
     * @return mixed
     * 支付类型添加
     */
    public static function insert($data){
        return self::create([
           'pay_type_name'=>$data['pay_type_name']
        ]);
    }

    /**
     * @param $id
     * @return mixed
     * 支付类型删除
     */
    public static function del($id){
        return self::where('id',$id)->delete();
    }

    /**
     * @param $data
     * @return mixed
     * 支付类型修改
     */
    public static function up($data){
        return self::where('id',$data['id'])->update([
           'pay_type_name'=>$data['pay_type_name']
        ]);
    }
}
